<?php

class Core_Controller_Action extends Zend_Controller_Action
{
    public function init()
    {
        parent::init();
        $this->view->layout()->messages = $this->_helper->FlashMessenger->getMessages();
    }

    /**
     *
     * Set message in flashMessenger and/or redirect
     * @access protected
     * @param string_type $msg Message
     * @param string $url URL
     * @return void
     */
    protected function _addMessage($msg, $url =null)
    {
        $translate = Zend_Registry::get('Zend_Translate');
        $this->_helper->flashMessenger($translate->_($msg));
        if (!empty($url)) {
            $this->_redirect($url);
        }
    }
}